<div class="container">
  <section>
    <h2>
      <a ui-sref="app.projects"><i class="fa fa-angle-left"></i> 返回</a> {{project.name}}
      <div class="pull-right" ng-if="depart_share || currentUser.department.name == '综合部'">
        <a ui-sref="app.projects-edit({projectId: project._id})">
          <small class="text-primary">
            <i class="fa fa-edit"></i>
            编辑
          </small>
        </a>
      </div>
    </h2>
    <br>

    <div class="row">
      <div class="col-md-4">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">项目名称</h3>
          </div>
          <div class="panel-body">
            {{project.name}}
          </div>
        </div>
      </div>

      <div class="col-md-4">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">项目类型</h3>
          </div>
          <div class="panel-body">
            {{project.type}}
          </div>
        </div>
      </div>

      <div class="col-md-4">

        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">负责人</h3>
          </div>
          <div class="panel-body">
            {{project.leader.name}}
          </div>
        </div>
      </div>

      <div class="col-md-4">

        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">参与者</h3>
          </div>
          <div class="panel-body">
        <span ng-repeat="joiner in project.joiners">
          {{joiner.name}}
        </span>
          </div>
        </div>
      </div>

      <div class="col-md-4">

        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">开工日期</h3>
          </div>
          <div class="panel-body">
            {{project.start_date | date: 'yyyy-MM-dd'}}
          </div>
        </div>
      </div>

      <div class="col-md-4">

        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">结束日期</h3>
          </div>
          <div class="panel-body">
            <span ng-if="project.is_completed">{{project.end_date | date: 'yyyy-MM-dd'}}</span>
            <span class="text-danger" ng-if="!project.is_completed">未结束</span>
          </div>
        </div>
      </div>

      <div class="col-md-4">

        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">是否竣工</h3>
          </div>
          <div class="panel-body">
            <span class="text-success" ng-if="project.is_completed">已竣工</span>
            <span class="text-danger" ng-if="!project.is_completed">未竣工</span>
          </div>
        </div>
      </div>

      <div class="col-md-4">

        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">工程进度</h3>
          </div>
          <div class="panel-body">
            {{project.progress}}
          </div>
        </div>
      </div>

      <div class="col-md-4">

        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">最近更新时间</h3>
          </div>
          <div class="panel-body">
            {{project.updated_at | date: 'yyyy-MM-dd HH:mm:ss'}}
          </div>
        </div>
      </div>
    </div>
    <hr />
    <div class="row">
      <div class="col-md-12">
        <button ng-file-select ng-model="projectFile" ng-file-change="upload()" ng-show="depart_share || currentUser.department.name == '综合部'"  multiple="false" class="btn btn-primary pull-right">上传资料</button> <span class="text-center"> {{progressStatus}} </span><span ng-show="progress" class="text-center">{{nowProgress}}</span>
      </div>

      <div class="col-md-12">
        <div class="table-responsive" ng-if="depart_share || currentUser.department.name == '综合部'">
          <table class="table table-striped">
            <thead>
              <tr>
                <th>编号</th>
                <th>文件名</th>
                <th>文件大小</th>
                <th>上传者</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              <tr ng-repeat="file in project.files">
                <td>{{($index+1)}}</td>
                <td>{{file.file_name}}</td>
                <td>{{file.file_size}}</td>
                <td>{{file._user.name}}</td>
                <td><a href="{{file.file_path}}" target="_blank">下载</a> <a href="" ng-click="removeFile(file._id, $index)" ng-if="currentUser.department.name == '综合部'">删除</a> </td>
              </tr>
            </tbody>
          </table>
        </div>
        <p class="lead text-center" ng-if="!depart_share && currentUser.department.name != '综合部'">对不起，你没有查看该工程材料的权限</p>
      </div>
    </div>
  </section>
</div>
